<template>
  <div>
    <MyHeader
      :background="'#000'"
      title="MyTabBar案例"
      
    ></MyHeader>
    <div class="main">
      <component :is="comName" :arr="arr"></component>
    </div>
    <MyTabBar :list="tabList" 
    @changeName="changeNameFn"
    ></MyTabBar>
  </div>
</template>

<script>
// 1底部传数据
// 2 MyGoodsList发起axios请求,传送数据给matable渲染

import MyHeader from "./components/MyHeader";
import MyTabBar from './components/MyTabBar.vue'
import MyGoodsList from './views/MyGoodsList.vue'
import MyGoodsSearch from './views/MyGoodsSearch.vue'
import MyUserInfo from './views/MyUserInfo.vue'
export default {
  components: {
    MyTabBar,
    MyHeader,
    MyGoodsList,
    MyGoodsSearch,
    MyUserInfo
  },
  data() {
    return {
      tabList: [
        {
          iconText: "icon-shangpinliebiao",
          text: "商品列表",
          componentName: "MyGoodsList",
        },
        {
          iconText: "icon-sousuo",
          text: "商品搜索",
          componentName: "MyGoodsSearch",
        },
        {
          iconText: "icon-user",
          text: "我的信息",
          componentName: "MyUserInfo",
        },
      ],
      comName:'MyGoodsList', //默认商品列表页
      arr : [] 
    };
  },
  
  methods: {
    changeNameFn(tName){
      this.comName = tName;
    }
  },
};
</script>

<style scoped>
.main{
  padding-top: 45px;
  padding-bottom: 51px;
}
</style>